using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TextEditor
{
    public partial class dlgHRuleProperty : DevComponents.DotNetBar.Office2007Form
    {
        public ZYTextHRule Rule = null;

        public dlgHRuleProperty()
        {
            InitializeComponent();
        }

        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (this.Rule != null)
            {
                this.Rule.ForeColor = this.cmdColor.BackColor;
                this.Rule.LineHeight = (int)this.txtWidth.Value;
            }
            base.DialogResult = DialogResult.OK;
            base.Close();
        }

        private void cmdCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void cmdColor_Click(object sender, EventArgs e)
        {
            using (ColorDialog dialog = new ColorDialog())
            {
                dialog.Color = this.cmdColor.BackColor;
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    this.cmdColor.BackColor = dialog.Color;
                }
            }
        }

        private void dlgHRuleProperty_Load(object sender, EventArgs e)
        {
            if (this.Rule != null)
            {
                this.txtWidth.Value = this.Rule.LineHeight;
                this.cmdColor.BackColor = this.Rule.ForeColor;
            }
        }
    }
}